package cn.source.subject.service.impl;

import java.util.List;

import cn.source.majors.domain.SMajors;
import cn.source.subject.domain.SMajorsSubjectVo;
import cn.source.subject.domain.SubjectselectschoolVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.source.subject.mapper.SmSubjectMapper;
import cn.source.subject.domain.SmSubject;
import cn.source.subject.service.ISmSubjectService;

/**
 * 选科与专业组合Service业务层处理
 *
 * @author xuhao
 * @date 2023-12-22
 */
@Service
public class SmSubjectServiceImpl implements ISmSubjectService
{
    @Autowired
    private SmSubjectMapper smSubjectMapper;

    /**
     * 查询选科与专业组合
     *
     * @param id 选科与专业组合主键
     * @return 选科与专业组合
     */
    @Override
    public SmSubject selectSmSubjectById(Long id)
    {
        return smSubjectMapper.selectSmSubjectById(id);
    }

    /**
     * 查询选科与专业组合列表
     *
     * @param smSubject 选科与专业组合
     * @return 选科与专业组合
     */
    @Override
    public List<SmSubject> selectSmSubjectList(SmSubject smSubject)
    {
        return smSubjectMapper.selectSmSubjectList(smSubject);
    }

    /**
     * 新增选科与专业组合
     *
     * @param smSubject 选科与专业组合
     * @return 结果
     */
    @Override
    public int insertSmSubject(SmSubject smSubject)
    {
        return smSubjectMapper.insertSmSubject(smSubject);
    }

    /**
     * 修改选科与专业组合
     *
     * @param smSubject 选科与专业组合
     * @return 结果
     */
    @Override
    public int updateSmSubject(SmSubject smSubject)
    {
        return smSubjectMapper.updateSmSubject(smSubject);
    }

    /**
     * 批量删除选科与专业组合
     *
     * @param ids 需要删除的选科与专业组合主键
     * @return 结果
     */
    @Override
    public int deleteSmSubjectByIds(Long[] ids)
    {
        return smSubjectMapper.deleteSmSubjectByIds(ids);
    }

    /**
     * 删除选科与专业组合信息
     *
     * @param id 选科与专业组合主键
     * @return 结果
     */
    @Override
    public int deleteSmSubjectById(Long id)
    {
        return smSubjectMapper.deleteSmSubjectById(id);
    }


    @Override
    public List<SubjectselectschoolVo> selectSubjectMajorList(SubjectselectschoolVo subject) {
        return smSubjectMapper.selectSubjectMajorList(subject);
    }

    @Override
    public List<SMajorsSubjectVo> selectmajorSubjectList(SMajorsSubjectVo subject) {
//        if (subject.getSchool().getCollegeLevel().isEmpty()){
//            int i = Integer.parseInt(subject.getSchool().getCollegeLevel());
//
//
//        }

        List<SMajorsSubjectVo> sMajorsSubjectVoList = smSubjectMapper.selectmajorSubjectList(subject);


        return sMajorsSubjectVoList;
    }
}
